<template>
  <div>
    <!-- 面包屑 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/about' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>订单管理</el-breadcrumb-item>
      <el-breadcrumb-item>订单列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card style="margin-top: 20px">
      <div id="main" style="width: 800px; height: 400px" ref="myCharts"></div>
    </el-card>
  </div>
</template>

<script>
import * as echarts from "echarts";
export default {
  data() {
    return {
      options: {}
    };
  },  

  created() {
    this.getData();
  },
  methods: {
    async getData() {
      const {
        data: { data },
      } = await this.$axios({
        url: "/api/private/v1/reports/type/1",
        method: "get",
      });
      this.options = data;
      this.options = {
        ...data,
        title: {
          text: "用户来源",
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
            label: {
              backgroundColor: "#E9EEF3",
            },
          },
        },
      };
      console.log(this.options, "6");
      this.loadEcharts()
    },
    loadEcharts(){
        const myCharts = echarts.init(this.$refs.myCharts)
        console.log(myCharts,'myCharts');
        this.options && myCharts.setOption(this.options)
    }
  },
};
</script>

<style lang="scss" scoped>
</style>   